home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TPUG - Toronto PET Users Group
/
TPUG Users Group CD
/
TPUG Users Group CD.iso
/
COMAL
/
B-Book Series
/
(k)b8.d64
/
circle1.l
< prev
next >
Wrap
Text File
|
2007-02-28
|
1KB
|
53 lines
0010 SETGRAPHIC 0
0020 HIDETURTLE
0030 FULLSCREEN
0040 PENCOLOR 1
0050 BACKGROUND 0
0060 BORDER 15
0070 FOR RADIUS:=10 TO 100 STEP 10 DO
0080 AT'X0:=119
0090 AT'Y0:=100
0100 CIRCLE(RADIUS,AT'X0,AT'Y0)
0110 ENDFOR RADIUS
0120 END
0130 PROC CIRCLE(RADIUS,X0,Y0) CLOSED
0140 // DRAW CIRCLE OF GIVEN RADIUS
0150 // CENTERED AT X0, Y0
0160 IF RADIUS<50 THEN
0170 N'STEPS:=36
0180 ELSE
0190 N'STEPS:=72
0200 ENDIF
0210 DTHETA:=6.283192/N'STEPS
0220 COS'DTHETA:=COS(DTHETA)
0230 SIN'DTHETA:=SIN(DTHETA)
0240 FIRST'X:=RADIUS; FIRST'Y:=0
0250 MOVE'TO(X0+FIRST'X,Y0+FIRST'Y)
0260 PREV'X:=FIRST'X; PREV'Y:=FIRST'Y
0270 FOR POINT:=1 TO N'STEPS DO
0280 NEXT'X:=PREV'X*COS'DTHETA-PREV'Y*SIN'DTHETA
0290 NEXT'Y:=PREV'X*SIN'DTHETA+PREV'Y*COS'DTHETA
0300 DRAW'TO(X0+NEXT'X,Y0+NEXT'Y)
0310 PREV'X:=NEXT'X; PREV'Y:=NEXT'Y
0320 ENDFOR POINT
0330 ENDPROC CIRCLE
0340 PROC MOVE'TO(X,Y) CLOSED
0350 ADJUST(X,Y)
0360 MOVETO X,Y
0370 ENDPROC MOVE'TO
0380 PROC DRAW'TO(X,Y) CLOSED
0390 ADJUST(X,Y)
0400 DRAWTO X,Y
0410 ENDPROC DRAW'TO
0420 PROC ADJUST(REF X,REF Y) CLOSED
0430 SCRUNCH:=1.34
0440 // NOTE: USING A SCRUNCH FACTOR
0450 // CORRECTS THE DIFFERENCE IN
0460 // VERTICAL AND HORIZONTAL UNITS
0470 //
0480 // MAX X IS REDUCED TO 238
0490 // HORIZONTAL CENTER IS 119
0500 //
0510 X:=SCRUNCH*X
0520 ENDPROC ADJUST